#pragma once

#include <vld.h>

#include "BeanieIncludes.h"
#include "BeanieDefines.h"
#include "BeanieEnums.h"

#include "WindowFramework.h"

#include "D3DFTexture.h"
#include "BeanieTexture.h"

#include "List.h"
#include "Vector2D.h"

//DirectInput Framework
class DirectInputFramework
{
public:
	//attributes & members
	WindowFramework* m_window;

	LPDIRECTINPUT8 m_object;
	LPDIRECTINPUTDEVICE8 m_keyboard;
	LPDIRECTINPUTDEVICE8 m_mouse;

	BYTE m_keyboardState[256];
	DIMOUSESTATE m_mouseState;

	bool m_cursorShow;
	POINT m_cursor;
	int m_cursorX;
	int m_cursorY;

	int m_prevKey;
	int m_prevButton;
	List<int> m_prevKeys;
	List<int> m_prevButtons;

	//ctor & dtor
	DirectInputFramework();
	~DirectInputFramework();

	//init functions
	int init(WindowFramework* a_window);

	//release functions
	int release();

	//update functions
	int acquire();

	//input functions
	bool keyInput(int a_key);
	bool keyPress(int a_key);
	bool anyPress();
	bool mouseInput(int a_button);
	bool mousePress(int a_button);
	void mouseDelta(
		long* a_x,
		long* a_y,
		long* a_z);
	void mousePosition(
		int* a_x,
		int* a_y);

	//setter functions
	void showCursor(bool a_bool)
	{m_cursorShow = a_bool;}
};